<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>vue学习</title>
  <link rel="stylesheet" type="text/css" href="css/bootstrap.css">
	<script src="js/vue.js"></script>
  <script src="js/vue-router.js"></script>
	<script src="https://cdn.jsdelivr.net/npm/axios@0.12.0/dist/axios.min.js"></script>
	<script src="https://cdn.jsdelivr.net/npm/lodash@4.13.1/lodash.min.js"></script>
  <style>
    body{ background: #999; }
  </style>
</head>
<body>
<div id="app" >
  <div class="row">
    <div class="col-xs-8 col-xs-offset-2" >
      <div class="page-header">
        <h1>TTTT教育</h1>
      </div>
    </div>
  </div>

  <div class="row">
    <div class="col-xs-2 col-xs-offset-2">
      <div class="list-group">
            <router-link class='list-group-item' to="/h5">html5学院</router-link>
            <router-link class='list-group-item' to="/java">java学院</router-link>
            <router-link class='list-group-item' to="/cc">cc学院</router-link>
      </div>
    </div> 
    <div class="col-xs-6">
      <div class="panel">
        <div class="panel-body">
             <!-- 路由出口 -->
            <!-- 路由匹配到的组件将渲染在这里 -->
          <router-view></router-view>
        </div>
      </div>
    </div>
  </div>
</div> 

<template id="h5">
  <div>
    <h2>html5学院</h2>
    <p>掌握aaaaaaaaaaa</p>
    <img src="img/head.png" width="200">
  </div>
</template>

<template id="java">
  <div>
    <h2>java学院</h2>
    <p>javajvavvavava</p>
    <img src="img/head.png" width="200">
  </div>
</template>

<template id="cc">
  <div>
    <h2>c学院</h2>
    <p>ccccccccccccccccc</p>
    <img src="img/head.png" width="200">
  </div>
</template>

</body>
</html>

<script> 
//1.创建组件
 const html5 = Vue.extend({
  template:'#h5'
 })

  const java = Vue.extend({
  template:'#java'
 })

   const cc = Vue.extend({
  template:'#cc'
 })

//定义路由
const routes = [
  { path: '/h5', component: html5 },
  { path: '/java', component: java },
  { path: '/cc', component: cc },
  //配置根路由
  {path: '/', redirect: '/h5'}
]

//创建路由实例
const router = new VueRouter({
      routes
})

//创建vue实例并挂载
 new Vue({
    router
}).$mount('#app')
</script>